package com.example.dao;

import com.example.entity.Book;
import com.example.entity.Params;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;


@Repository
public interface BookDao extends Mapper<Book> {

    List<Book> findBySearch(@Param("params") Params params);

    @Insert("insert into book (name,number,college,major,photo,submissionstatus,count)" +
            " values (#{name},#{number},#{college},#{major},#{photo},#{submissionstatus},#{count})")
    void addStudent(Book book);

//    @Update("update student set count = count + 1 where name = #{name} and id_card = #{idCard} and number = #{adnumber}")
    @Update("update book set name=#{name} where number = #{number}")
    void updateStudent(Book book);
    @Select("select count(*) from book where number = #{number} ")
    int selectCountByNumber(String number);


    @Select("select * from student where number = #{studentNumber}")
    Book slectInforByNUmber(String studentNumber);
}
